<?php

/**
 * This is the model class for table "tngkeskonseling".
 *
 * The followings are the available columns in table 'tngkeskonseling':
 * @property integer $tngk_id
 * @property integer $tngk_kec
 * @property integer $tngk_kes_dokter
 * @property integer $tngk_kes_prwat
 * @property integer $tngk_kes_bidan
 * @property integer $tngk_kon_dokter
 * @property integer $tngk_kon_prwat
 * @property integer $tngk_kon_bidan
 * @property integer $tngk_tahun
 *
 * The followings are the available model relations:
 * @property Kecamatan $tngkKec
 */
class Tngkeskonseling extends CActiveRecord
{
	/**
	 * Returns the static model of the specified AR class.
	 * @return Tngkeskonseling the static model class
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}

	/**
	 * @return string the associated database table name
	 */
	public function tableName()
	{
		return 'tngkeskonseling';
	}

	/**
	 * @return array validation rules for model attributes.
	 */
	public function rules()
	{
		// NOTE: you should only define rules for those attributes that
		// will receive user inputs.
		return array(
			array('tngk_kec, tngk_kes_dokter, tngk_kes_prwat, tngk_kes_bidan, tngk_kon_dokter, tngk_kon_prwat, tngk_kon_bidan, tngk_tahun', 'numerical', 'integerOnly'=>true),
			// The following rule is used by search().
			// Please remove those attributes that should not be searched.
			array('tngk_id, tngk_kec, tngk_kes_dokter, tngk_kes_prwat, tngk_kes_bidan, tngk_kon_dokter, tngk_kon_prwat, tngk_kon_bidan, tngk_tahun', 'safe', 'on'=>'search'),
		);
	}

	/**
	 * @return array relational rules.
	 */
	public function relations()
	{
		// NOTE: you may need to adjust the relation name and the related
		// class name for the relations automatically generated below.
		return array(
			'tngkKec' => array(self::BELONGS_TO, 'Kecamatan', 'tngk_kec'),
		);
	}

	/**
	 * @return array customized attribute labels (name=>label)
	 */
	public function attributeLabels()
	{
		return array(
			'tngk_id' => 'Tngk',
			'tngk_kec' => 'Tngk Kec',
			'tngk_kes_dokter' => 'Tngk Kes Dokter',
			'tngk_kes_prwat' => 'Tngk Kes Prwat',
			'tngk_kes_bidan' => 'Tngk Kes Bidan',
			'tngk_kon_dokter' => 'Tngk Kon Dokter',
			'tngk_kon_prwat' => 'Tngk Kon Prwat',
			'tngk_kon_bidan' => 'Tngk Kon Bidan',
			'tngk_tahun' => 'Tngk Tahun',
		);
	}

	/**
	 * Retrieves a list of models based on the current search/filter conditions.
	 * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
	 */
	public function search()
	{
		// Warning: Please modify the following code to remove attributes that
		// should not be searched.

		$criteria=new CDbCriteria;

		$criteria->compare('tngk_id',$this->tngk_id);
		$criteria->compare('tngk_kec',$this->tngk_kec);
		$criteria->compare('tngk_kes_dokter',$this->tngk_kes_dokter);
		$criteria->compare('tngk_kes_prwat',$this->tngk_kes_prwat);
		$criteria->compare('tngk_kes_bidan',$this->tngk_kes_bidan);
		$criteria->compare('tngk_kon_dokter',$this->tngk_kon_dokter);
		$criteria->compare('tngk_kon_prwat',$this->tngk_kon_prwat);
		$criteria->compare('tngk_kon_bidan',$this->tngk_kon_bidan);
		$criteria->compare('tngk_tahun',$this->tngk_tahun);

		return new CActiveDataProvider($this, array(
			'criteria'=>$criteria,
		));
	}
}